/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sunsite.service;

import java.util.Date;
import sunsite.dao.VisitDao;
import sunsite.po.Visit;

/**
 *
 * @author mg
 */
public class VisitServiceImpl implements VisitService {

    private VisitDao visitDao;

    public void setVisitDao(VisitDao visitDao) {
        this.visitDao = visitDao;
    }

    public String logVisit(Date dt, String ipAddress) throws Exception {
        Visit visit = new Visit();
        visit.setVisitId("visit" + System.nanoTime());
        visit.setVisitIp(ipAddress);
        visit.setVisitTime(dt);
        visit.setIslogin(0);
        visitDao.createVisit(visit);
        return visit.getVisitId();
    }

}
